﻿using System;
using System.Collections.Generic;
using System.IO;
using Nakio.Framework.Communication;

namespace Nakio.SystemAdministration.Commands
{
    [Serializable]
    public class GetDirectoriesCommand : CommandBase
    {
        private readonly string _path;
        public GetDirectoriesCommand(string path)
        {
            _path = path;
        }

        public override object Execute()
        {
            var directoryDicc = new Dictionary<string, DirectoryInfo>();
            var directories = Directory.GetDirectories(_path);
            foreach (var directory in directories)
            {
                var directoryInfo = new DirectoryInfo(directory);
                directoryDicc.Add(directory,directoryInfo);
            }
            return directoryDicc;
        }
    }
}
